package java_persistence;

import java.util.List;
import org.apache.ibatis.annotations.Param;
import domain.Services;


/**
 * @author joseph simoneau <simoneau@gatech.edu>
 *
 */
public interface ServicesMapper {

	//Database functionality
	
	// CREATE

	/**Stores a new Service object in the database.
	 * @param sn the service name
	 * @param p the service price.
	 */
	public void create(@Param("service_name") String sn, @Param("price") Float p);
	
	// RETRIEVE
	
	/**Retrieves the services perfomred at an appointment on date with patient with usenrame pu
	 * @param d the date of the associated appointment
	 * @param pu the username of the patient
	 * @return the services performed.
	 */
	public List<Services> retrieve_by_appointment(@Param("date") String d, @Param("patient_username") String pu);
	/**Retrieves a service object by the name of the service
	 * @param name the name of the service
	 * @return the Service object.
	 */
	public Services get_service_by_name(String name);
	/**Retrieves a list of names of all services currently stored in the database
	 * @return a list of strings that represent service names.
	 */
	public List<String> get_all_service_names();
	
	// UPDATE
	
	/**Updates the price for a given service name already stored in the database 
	 * @param sn the name of the service
	 * @param p the price of the service
	 */
	public void update_price(@Param("service_name") String sn, @Param("price") Float p);
	
	// DELETE
	
	/**Deletes an invoice associated with an appointment on date d with patient with username pu.
	 * 
	 * Note that it is unwise and often unlawful to delte medical records.  This method is provided primarily for testing purposes.
	 * 
	 * @param d the date of the appointment
	 * @param pu the username of the patient
	 */
	public void delete_invoice(@Param("date") String d, @Param("patient_username") String pu);
	/**Deletes a service from the list of services.
	 * 
	 * Note that if the service to be deleted is associated with any treatment record or appointment, this method will generate an error by violating a mySQL integrity constraint. As such, it is primarily for testing purposes.   
	 * 
	 * @param sn the name of the service to delete.
	 */
	public void delete(@Param("service_name") String sn );
	
}
